#pragma once
#include <glm/mat4x4.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
class DOpenGLCamera
{
private:
	glm::mat4 overallTransformMatrix;
	glm::vec3 viewRotation;
	glm::vec3 viewPosition;
	glm::vec3 viewCenter;
	glm::vec3 viewDir_right;
	glm::vec3 viewDir_up;
	float viewPortScale;
	glm::mat4 projectionMatrix;
	glm::mat4 viewMatrix;
public:
	enum DragingType
	{
		DRAG_NONE = 0,
		DRAG_ROTATE,
		DRAG_TRANSLATE,
		DRAG_ZOOM
	};
	DragingType dragingType;
	int draging_ox;
	int draging_oy;

public:
	void StartDrag(int mouse_x, int mouse_y, DragingType type);
	void Drag(int mouse_x, int mouse_y);
	void StopDrag();
	const float* GetProjectionMatrixDataPtr() const;
	const float* GetViewMatrixDataPtr() const;
private:
	void CalcViewMatrix();
public:
	DOpenGLCamera(void);
	~DOpenGLCamera(void);
};

